home *** CD-ROM | disk | FTP | other *** search
/ Shareware Super Platinum 8 / Shareware Super Platinum 8.iso / mac / PROGTOOL / MDF120.ZIP;1 / MDFL120.ZIP / SAMPLE.CPP < prev   
Encoding:
C/C++ Source or Header  |  1993-10-15  |  1.1 KB  |  79 lines

  1.  
  2. #include <stdio.h>
  3. #include <string.h>
  4.  
  5.  
  6. #include "mpatch.h"
  7.  
  8.  
  9.  
  10. class MyPatch : public MPatch
  11.     {
  12.     public:
  13.      void Show_start();
  14.      void Show();
  15.      void Show_end();
  16.     };
  17.  
  18.  
  19. void MyPatch::Show_start()
  20. {
  21.  puts("\nStart appling patch. Please Wait...");
  22. }
  23.  
  24. void MyPatch::Show()
  25. {
  26.  static short i=0;
  27.  printf("%3d",i++);
  28. }
  29.  
  30. void MyPatch::Show_end()
  31. {
  32.  puts("\nOk. Finished!");
  33. }
  34.  
  35.  
  36.  
  37.  
  38.  
  39. int main(int argc, char *argv[])
  40. {
  41.  MyPatch patch;
  42.  
  43.  puts("SAMPLE - A simply *.MDF applier");
  44.  puts("(C) 1993/94 Maurizio Giunti");
  45.  
  46.  char diffile[256];
  47.  char oldfile[256];
  48.  char newfile[256];
  49.  
  50.  if((argc<2)||(argc>4))
  51.     {
  52.      puts("Usage: SAMPLE <mdf> [<old>] [<new>]");
  53.      return 0;
  54.     }
  55.  
  56.  *diffile=NULL;
  57.  *oldfile=NULL;
  58.  *newfile=NULL;
  59.  
  60.  for(short i=1;i<argc;i++)
  61.     {
  62.      if(*diffile==NULL) strcpy(diffile,argv[i]);
  63.      else if(*oldfile==NULL) strcpy(oldfile,argv[i]);
  64.      else strcpy(newfile,argv[i]);
  65.     }
  66.  
  67.  patch.SetRate(3);
  68.  if(patch.MDFPatch(diffile,oldfile,newfile)!=0)
  69.     {
  70.      puts(patch.LastError());
  71.     }
  72.  else puts("<Done!>");
  73.  return 0;
  74. }
  75.  
  76.  
  77.  
  78.  
  79.